package top.tagao.m01_structuralPatterns.s_03_adapter.clazz;

import top.tagao.m01_structuralPatterns.s_03_adapter.Player;
import top.tagao.m01_structuralPatterns.s_03_adapter.target.Zh_JPTranslator;

/**
 * @author fu-xiao-liu
 * @Date 2022/7/27 21:52
 * 继承的方式：类结构模型，适配转换到了翻译器的功能上
 *
 *
 */
public class JPMoviePlayerAdapter extends Zh_JPTranslator   implements Player {

    private Player target;//适配对象

    //1. private Zh_JPTranslator z;
    public JPMoviePlayerAdapter(Player target){
        this.target = target;
       //2. z = new Zh_JPTranslator();
    }

    @Override
    public String play() {

        String play = target.play();
        //转换字幕
        String translate = translate(play);
        //3.String translate = z.translate(play);
        System.out.println("日文："+translate);
        return play;

    }
}